package com.dddpeter.app.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.time.LocalDateTime;

@TableName("articles")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Article {
    
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    
    @TableField("title")
    private String title;
    
    @TableField("content")
    private String content;
    
    @TableField("author_id")
    private Long authorId;
    
    @TableField("status")
    private ArticleStatus status = ArticleStatus.DRAFT;
    
    @TableField("categories")
    private String categories;  // 文章分类，多个用逗号分隔
    
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;
    
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;
    
    public enum ArticleStatus {
        DRAFT, PUBLISHED, ARCHIVED
    }
}
